package org.ims.inv.model.conference;

import java.util.Date;
import java.util.Set;

import org.ims.inv.model.system.ModelAppUser;

import cn.trymore.core.model.ModelBase;

/**
 * Model: 会议信息
 * 
 * @author x36zhao
 *
 */
public class ModelConference
extends ModelBase
{

	private static final long serialVersionUID = 2307093869437853651L;
	
	/**
	 * 申请人
	 */
	private ModelAppUser applicant;
	
	/**
	 * 申请时间
	 */
	private Date applyTime;
	
	/**
	 * 参会时间
	 */
	private Date time;
	
	/**
	 * 会议名称
	 */
	private String title;
	
	/**
	 * 会议地点
	 */
	private String place;
	
	/**
	 * 参会人员ID集合
	 */
	private String attendeeIds;
	
	/**
	 * 参会人员姓名集合
	 */
	private String attendeeNames;
	
	/**
	 * 会议简介
	 */
	private String introduction;
	
	/**
	 * 申请理由
	 */
	private String reason;
	
	/**
	 * 会务费
	 */
	private Double fee;
	
	/**
	 * 赞助费
	 */
	private Double sponsorship;
	
	/**
	 * 差旅费
	 */
	private Double travelFee;
	
	/**
	 * 状态
	 */
	private Integer status;
	
	/**
	 * 创建时间
	 */
	private Date creationTime;
	
	/**
	 * 登记人
	 */
	private String recorderName;
	
	/**
	 * 部门负责人意见
	 */
	private String deptMeto;
	
	/**
	 * 院领导意见
	 */
	private String leadershipMeto;
	
	/**
	 * 院领导审批标志, 0: 不需要院领导审批, 1: 需要院领导审批
	 */
	private Integer leaderAudit;
	
	/**
	 * 审批流程历史事件
	 */
	private Set<ModelConferenceEvent> events;
	
	/**
	 * 申请人姓名
	 */
	private String applicantName;
	
	/**
	 * 会议资料
	 */
	private Set<ModelConferenceMaterial> materials;
	
	/**
	 * The enumeration of conference status
	 * 
	 * @author Jeccy.Zhao
	 *
	 */
	public static enum EConferenceStatus
	{
		AUDITING(0, "auditing"),				// 审批中
		PASSED(1, "passed"),					// 已通过
		RETURNED(-1, "returned"),				// 已退回
		REJECTED(2, "rejected");				// 未通过
		
		private Integer value;
		private String text;
		
		EConferenceStatus (Integer value, String text)
		{
			this.value = value;
			this.text = text;
		}
		
		public Integer getValue(){
			return value;
		}
		
		public String getText()
		{
			return this.text;
		}
	}
	
	/**
	 * 获取总费用
	 * @return
	 */
	public double getTotalFee()
	{
		double totalFee = 0;
		
		if (fee != null)
		{
			totalFee += fee;
		}
		
		if (sponsorship != null)
		{
			totalFee += sponsorship;
		}
		
		if (travelFee != null)
		{
			totalFee += travelFee;
		}
		
		return totalFee;
	}
	
	public Date getTime()
	{
		return time;
	}

	public void setTime(Date time)
	{
		this.time = time;
	}

	public String getTitle()
	{
		return title;
	}

	public void setTitle(String title)
	{
		this.title = title;
	}

	public String getPlace()
	{
		return place;
	}

	public void setPlace(String place)
	{
		this.place = place;
	}

	public String getAttendeeIds()
	{
		return attendeeIds;
	}

	public void setAttendeeIds(String attendeeIds)
	{
		this.attendeeIds = attendeeIds;
	}

	public String getAttendeeNames()
	{
		return attendeeNames;
	}

	public void setAttendeeNames(String attendeeNames)
	{
		this.attendeeNames = attendeeNames;
	}

	public String getIntroduction()
	{
		return introduction;
	}

	public void setIntroduction(String introduction)
	{
		this.introduction = introduction;
	}

	public String getReason()
	{
		return reason;
	}

	public void setReason(String reason)
	{
		this.reason = reason;
	}

	public Double getFee()
	{
		return fee;
	}

	public void setFee(Double fee)
	{
		this.fee = fee;
	}

	public Double getSponsorship()
	{
		return sponsorship;
	}

	public void setSponsorship(Double sponsorship)
	{
		this.sponsorship = sponsorship;
	}

	public Double getTravelFee()
	{
		return travelFee;
	}

	public void setTravelFee(Double travelFee)
	{
		this.travelFee = travelFee;
	}

	public Integer getStatus()
	{
		return status;
	}

	public void setStatus(Integer status)
	{
		this.status = status;
	}

	public Date getCreationTime()
	{
		return creationTime;
	}

	public void setCreationTime(Date creationTime)
	{
		this.creationTime = creationTime;
	}

	public String getRecorderName()
	{
		return recorderName;
	}

	public void setRecorderName(String recorderName)
	{
		this.recorderName = recorderName;
	}

	public String getDeptMeto()
	{
		return deptMeto;
	}

	public void setDeptMeto(String deptMeto)
	{
		this.deptMeto = deptMeto;
	}

	public String getLeadershipMeto()
	{
		return leadershipMeto;
	}

	public void setLeadershipMeto(String leadershipMeto)
	{
		this.leadershipMeto = leadershipMeto;
	}

	public Set<ModelConferenceEvent> getEvents()
	{
		return events;
	}

	public void setEvents(Set<ModelConferenceEvent> events)
	{
		this.events = events;
	}

	public ModelAppUser getApplicant()
	{
		return applicant;
	}

	public void setApplicant(ModelAppUser applicant)
	{
		this.applicant = applicant;
	}

	public Date getApplyTime()
	{
		return applyTime;
	}

	public void setApplyTime(Date applyTime)
	{
		this.applyTime = applyTime;
	}

	public Integer getLeaderAudit()
	{
		return leaderAudit;
	}

	public void setLeaderAudit(Integer leaderAudit)
	{
		this.leaderAudit = leaderAudit;
	}

	public String getApplicantName()
	{
		if (this.applicant != null)
		{
			this.applicantName = this.applicant.getUsername();
		}
		
		return applicantName;
	}

	public Set<ModelConferenceMaterial> getMaterials()
	{
		return materials;
	}

	public void setMaterials(Set<ModelConferenceMaterial> materials)
	{
		this.materials = materials;
	}
}
